<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class ListController extends Controller
{
    //发表
    public function deliver()
    {
        return view('deliver');
    }

    public function loveText(Request $request)
    {
        $data = $request->except('_token');
        $data['uid']=session('uid');
        DB::table('love_list')->insert($data);
        return redirect()->route('home');
    }
    //首页
    public function home(){

        $data = DB::table('love_list')
            ->join('user','user.id','=','love_list.uid')
            ->get();
        return view('home',['data'=>$data]);
    }
}
